package com.itheima.pattern.mediator;

public class MediatorStructure extends Mediator{

    private HouseOwner houseOwner;
    private Tenant tenant;

    public HouseOwner getHouseOwner() {
        return houseOwner;
    }

    public void setHouseOwner(HouseOwner houseOwner) {
        this.houseOwner = houseOwner;
    }

    public Tenant getTenant() {
        return tenant;
    }

    public void setTenant(Tenant tenant) {
        this.tenant = tenant;
    }


    /**
     * 和同事类进行交互的方法
     * @param message
     * @param person
     */
    @Override
    public void constact(String message, Person person) {
        if(person==houseOwner){
            tenant.getMessage(message);
        }else if(person==tenant){
            houseOwner.getMessage(message);
        }else {
            System.out.println("你来错地方了");
        }

    }
}
